package JavaSe;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}15:04
 */
public class HashSetTest {
    class Name{
        private String first;
        private String last;

        public Name(String first, String last) {
            this.first = first;
            this.last = last;
        }

        //判断first判断两个Name是否相等

        @Override
        public int hashCode() {
            return first.hashCode();
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj){
                return true;
            }
            if (obj.getClass() == Name.class){
                Name name = (Name) obj;
                return name.first.equals(first);
            }
            return false;
        }
    }
}
